package com.nsn.auction.dao.impl;

import java.util.List;

import com.nsn.auction.dao.UserDao;
import com.nsn.auction.domina.User;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class UserDaoImpl extends CustomHibernateDaoSupport implements UserDao {

	@Override
	public void save(User user) {
		getHibernateTemplate().save(user);

	}

	@Override
	public void update(User user) {
		getHibernateTemplate().update(user);

	}

	@Override
	public void delete(User user) {
		getHibernateTemplate().delete(user);

	}

	@Override
	public User findUserById(Long userId) {
		List<User> list = getHibernateTemplate().find("from User where userId=?", userId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}

}
